package com.genius.model;

import java.util.List;

public class BatchCounter
{
    List batchList = null;
    int total = 0;
    int activeCount = 0;
    int inactiveCount = 0;
    int level1Count = 0;
    int level2Count = 0;
    int level3Count = 0;
    int level4Count = 0;
    int level5Count = 0;
    int level6Count = 0;
    int level7Count = 0;
    int level8Count = 0;
    
    

    public BatchCounter(List batchList)
    {
        this.batchList = batchList;
        total = batchList.size();
        if(total>0) {
            activeCount = calculateActiveCount(batchList);
            inactiveCount = total - activeCount;
        }
    }
    
    private int calculateActiveCount(List bList) {
        int count = 0;
        int size = bList.size();
        for (int i = 0; i<size; i++) {
            Batch b = (Batch)bList.get(i);
            if(b.isActiveFlag()){
                count++;
                int level = b.getLevel();
                if(level == 1) {
                    level1Count++;
                } else if (level == 2) {
                    level2Count++;
                } else if (level == 2) {
                    level2Count++;
                } else if (level == 3) {
                    level3Count++;
                }
                else if (level == 4) {
                    level4Count++;
                }
                else if (level == 5) {
                    level5Count++;
                }

                else if (level == 6) {
                    level6Count++;
                }

                else if (level == 7) {
                    level7Count++;
                }
                else if (level == 8) {
                    level8Count++;
                }
            }
        }
        return count;
    }
    
    /**
     * @return Returns the inactiveCount.
     */
    public int getInactiveCount()
    {
        return inactiveCount;
    }

    /**
     * @return Returns the level1Count.
     */
    public int getLevel1Count()
    {
        return level1Count;
    }

    /**
     * @return Returns the level2Count.
     */
    public int getLevel2Count()
    {
        return level2Count;
    }

    /**
     * @return Returns the level3Count.
     */
    public int getLevel3Count()
    {
        return level3Count;
    }

    /**
     * @return Returns the level4Count.
     */
    public int getLevel4Count()
    {
        return level4Count;
    }

    /**
     * @return Returns the level5Count.
     */
    public int getLevel5Count()
    {
        return level5Count;
    }

    /**
     * @return Returns the level6Count.
     */
    public int getLevel6Count()
    {
        return level6Count;
    }

    /**
     * @return Returns the level7Count.
     */
    public int getLevel7Count()
    {
        return level7Count;
    }

    /**
     * @return Returns the level8Count.
     */
    public int getLevel8Count()
    {
        return level8Count;
    }

    /**
     * @return Returns the total.
     */
    public int getTotal()
    {
        return total;
    }

    /**
     * @return Returns the activeCount.
     */
    public int getActiveCount()
    {
        return activeCount;
    }

    /**
     * @return Returns the batchList.
     */
    public List getBatchList()
    {
        return batchList;
    }

    /**
     * @param batchList The batchList to set.
     */
    public void setBatchList(List batchList)
    {
        this.batchList = batchList;
    }
    
    
}
